/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.business.fee.core.repository.entity;

import com.gitee.peigenlpy.actable.annotation.Column;
import com.gitee.peigenlpy.actable.annotation.Index;
import com.gitee.peigenlpy.actable.annotation.Table;
import com.gitee.peigenlpy.actable.annotation.Unique;
import com.gitee.peigenlpy.actable.constants.MySqlCharsetConstant;
import com.gitee.peigenlpy.actable.constants.MySqlEngineConstant;
import com.gitee.peigenlpy.actable.constants.MySqlTypeConstant;
import info.peigen.hotpot.business.fee.facade.enums.FeeAction;
import info.peigen.hotpot.business.fee.facade.enums.FeeProductCode;
import info.peigen.hotpot.common.core.enums.Currency;
import info.peigen.hotpot.common.core.lang.money.Money;
import info.peigen.hotpot.component.data.repository.beetlsql.entity.AbstractCreateTimeEntity;
import info.peigen.hotpot.component.data.repository.beetlsql.handler.MoneyBeetlSqlHandler;
import lombok.*;
import lombok.experimental.Accessors;
import lombok.experimental.FieldDefaults;

/**
 * <b>(AccountLogEntity)</b>
 * 收费记录表
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2021/8/1
 */
@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@FieldDefaults(level = AccessLevel.PRIVATE)
@Accessors(chain = true)
@Table(name = "fee_log", comment = "收费记录表", charset = MySqlCharsetConstant.UTF8MB4, engine = MySqlEngineConstant.InnoDB)
@org.beetl.sql.annotation.entity.Table(name = "fee_log")
public class FeeLogEntity extends AbstractCreateTimeEntity {
    @Column(name = "fee_log_id", type = MySqlTypeConstant.VARCHAR, length = 30, comment = "feeLogId")
    @Unique(value = "feeLogId", columns = "fee_log_id")
    @org.beetl.sql.annotation.entity.Column("fee_log_id")
    String         feeLogId;
    @Column(name = "trade_id", type = MySqlTypeConstant.VARCHAR, length = 30, isNull = false, comment = "tradeId")
    @Index(value = "tradeId", columns = "trade_id")
    @org.beetl.sql.annotation.entity.Column("trade_id")
    String         tradeId;
    @Column(name = "account_id", type = MySqlTypeConstant.VARCHAR, length = 30, comment = "被收费账户Id")
    @Index(value = "accountId", columns = "account_id")
    @org.beetl.sql.annotation.entity.Column("account_id")
    String         accountId;
    @Column(name = "action", type = MySqlTypeConstant.VARCHAR, length = 50, isNull = false, comment = "收费行为")
    @Index(value = "action", columns = "action")
    @org.beetl.sql.annotation.entity.Column("action")
    FeeAction      action;
    @Column(name = "code", type = MySqlTypeConstant.VARCHAR, length = 50, isNull = false, comment = "收费产品码")
    @Index(value = "code", columns = "code")
    @org.beetl.sql.annotation.entity.Column("code")
    FeeProductCode code;
    @Column(name = "payee_account_id", type = MySqlTypeConstant.VARCHAR, length = 30, isNull = false, comment = "收费账户Id")
    @Index(value = "payeeAccountId", columns = "payee_account_id")
    @org.beetl.sql.annotation.entity.Column("payee_account_id")
    String         payeeAccountId;
    @Column(name = "fee_amount", type = MySqlTypeConstant.DECIMAL, length = 65, isNull = false, defaultValue = "0", comment = "收费金额")
    @org.beetl.sql.annotation.entity.Column("fee_amount")
    @MoneyBeetlSqlHandler
    Money          feeAmount;
    @Column(name = "charge_fee_amount", type = MySqlTypeConstant.DECIMAL, length = 65, isNull = false, defaultValue = "0", comment = "收费金额")
    @org.beetl.sql.annotation.entity.Column("charge_fee_amount")
    @MoneyBeetlSqlHandler
    Money          chargeFeeAmount;
    @Column(name = "service_fee_amount", type = MySqlTypeConstant.DECIMAL, length = 65, isNull = false, defaultValue = "0", comment = "收费金额")
    @org.beetl.sql.annotation.entity.Column("service_fee_amount")
    @MoneyBeetlSqlHandler
    Money          serviceFeeAmount;
    @Column(name = "fee_currency", type = MySqlTypeConstant.VARCHAR, length = 3, comment = "收费金额币种")
    @org.beetl.sql.annotation.entity.Column("fee_currency")
    Currency       feeCurrency;
    @Column(name = "memo", type = MySqlTypeConstant.VARCHAR, length = 200, comment = "备注")
    @org.beetl.sql.annotation.entity.Column("memo")
    String         memo;
    @Column(name = "fee_rule", type = MySqlTypeConstant.JSON, length = 512, comment = "收费规则(json)")
    @org.beetl.sql.annotation.entity.Column("fee_rule")
    String         feeRule;
}